//#include "Dependency.h"

#include "Kinect_Manager.h"

#if _MSC_VER // this is defined when compiling with Visual Studio
#define EXPORT_API __declspec(dllexport) // Visual Studio needs annotating exported functions with this
#else
#define EXPORT_API // XCode does not need annotating exported functions, so define is empty
#endif

typedef unsigned char byte;

Kinect_Manager Kinect;

extern "C"
{
	IplImage *Depth;
	IplImage *Rgb;

	int EXPORT_API Init_kinect()
	{
		IplImage *Rgb = cvCreateImage(cvSize(IMG_WIDTH, IMG_HEIGHT), IPL_DEPTH_8U, 3);
		IplImage *Depth = cvCreateImage(cvSize(IMG_WIDTH, IMG_HEIGHT), IPL_DEPTH_8U, 1);
		
		if(!Kinect.InitializeKinect()){
			//printf("Cannot find Kinect Device!\n");
			return -1;
		}else
			return 0;
	}

	void EXPORT_API Release_img(){
		cvReleaseImage(&Rgb);
		cvReleaseImage(&Depth);
	}

	EXPORT_API byte * getRGB()
	{
		Kinect.GetRgbFrame(Rgb);

		return (byte *)Rgb->imageData;
	}

	EXPORT_API byte * getDEPTH()
	{
		Kinect.GetDepthFrame(Depth);

		return (byte *)Depth->imageData;
	}

	int EXPORT_API test(){
		return 0;
	}
} 